#include <iostream>
#include <cmath>
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    return a / gcd(a, b) * b;
}

int m, n;

void solve();
int main() {
    while (cin >> m >> n) {
        solve();
    }    
}

void solve() {
    ll g = gcd(m, n), l = lcm(m, n);
    ll constrain = l / g;
    ll middle = sqrt(constrain);
    ll a = 1, b = constrain;
    for (ll i = 1; i <= constrain; i++) {
        if (constrain % i == 0) {
            ll temp = constrain / i;
            if (temp + i < a + b){
                a = min(temp, i);
                b = max(temp, i);
            }
        }
    }
    cout << a * g << " " << b * g<< endl;
}